<template>
  <div>
    <detail-banner :gallaryImgs="gallaryImgs"
                   :bannerImg="bannerImg"
                   :sightName="sightName">
    </detail-banner>
    <detail-header></detail-header>
    <div class="con">
      <detail-list :list="list"></detail-list>
    </div>
  </div>
</template>

<script>
  import DetailBanner from './components/banner'
  import DetailHeader from './components/Header'
  import DetailList from './components/List'
  import axios from 'axios'
  export default {
    components: {
      DetailBanner,
      DetailHeader,
      DetailList
    },
    name: "Detail",
    data() {
      return{
        sightName:'',
        list:[],
        bannerImg:[],
        gallaryImgs:[]
      }
    },
    methods:{
      getDetail(){
        axios.get('api/detail.json?id=' + this.$route.params.id).then(res=>{
          res = res.data
          if (res.ret && res.data){
            const data = res.data
            this.sightName = data.sightName
            this.bannerImg = data.bannerImg
            this.gallaryImgs = data.gallaryImgs
            this.list = data.categoryList
          }
        })
      }
    },
    mounted(){
      this.getDetail()
    }
  }
</script>

<style lang="stylus" scoped>
.con
  height 50rem
</style>
